<link href="https://cdn.bootcss.com/weui/1.1.2/style/weui.min.css" rel="stylesheet">
<script type="text/javascript" src="https://res.wx.qq.com/open/libs/weuijs/1.1.3/weui.min.js"></script>
<style>
    .weui-cells{
        font-size: 13px;
    }
</style>
<div id='app' style="padding-bottom:50px;" class='page'>
    <div class="weui-cells__title">订单类型</div>
    <div class="weui-cells weui-cells_radio">
        <label class="weui-cell weui-check__label" for="x11">
            <div class="weui-cell__bd">
                <p>补货</p>
            </div>
            <div class="weui-cell__ft">
                <input type="radio" class="weui-check" name="radio1" id="x11" value='2' v-model='order.order_type'>
                <span class="weui-icon-checked"></span>
            </div>
        </label>
    </div>

    
    <div class="weui-cells__title">订单详情</div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">补货金额</label></div>
            <div class="weui-cell__bd">
                <input v-model='order.number' class="weui-input" type="number" placeholder="请输入补货金额(<?=C('BUHUO_NUM')?>的倍数)">
            </div>
        </div>
        
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">需支付金额</label></div>
            <div class="weui-cell__bd">
                <input v-model='moneyarr.goods_money' readonly class="weui-input" type="number" >
            </div>
        </div>
    </div>
   
    <?php if($memberinfo['cash_money']>0){ ?>
    <div class="weui-cells__title"><?=C("CASH_NAME")?></div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell weui-cell_switch">
            <div class="weui-cell__bd">是否使用<?=C("CASH_NAME")?>(<?=$memberinfo['cash_money']?>)</div>
            <div class="weui-cell__ft">
                <input v-model="order.is_cash" class="weui-switch" type="checkbox">
            </div>
        </div>
    </div>
    <?php } ?>
    <?php if($memberinfo['money']>0){ ?>
    <div class="weui-cells__title"><?=C("YONGJIN_NAME")?></div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell weui-cell_switch">
            <div class="weui-cell__bd">是否使用<?=C("YONGJIN_NAME")?>(<?=$memberinfo['money']?>)</div>
            <div class="weui-cell__ft">
                <input v-model="order.is_yongjin" class="weui-switch" type="checkbox">
            </div>
        </div>
    </div>
    <?php } ?>
    
    <div style='padding:20px 15px;'>
        <a @click='addOrder' href="javascript:;" class="weui-btn weui-btn_primary">提交</a>
    </div>
</div>

<div style="width:100%;white-space:normal;padding:20px 15px;box-sizing: border-box;">
    <p>
    温馨提示
</p>
<ol class="ol1 list-paddingleft-2" style=" font-family: sans-serif; white-space: normal;">
    <li>
        <p>
            1、不同级别享受的价格优惠不同，消费越多优惠越高
        </p>
    </li>
    <li>
        <p>
            2、成为相应优惠会员后，永久消费数量产品，享受对应优惠
        </p>
    </li>
    <li>
        <p>
            3、非产品质量问题，下单后暂不支持退货
        </p>
    </li>
</ol>
</div>

<include file="Common:nav" />
<script src="https://cdn.bootcss.com/vue/2.4.4/vue.min.js"></script>
<script src="__STATIC__mobile/js/areadata.js"></script>
<script src="__STATIC__mobile/js/myarea.js"></script>

<script>
    var app = new Vue({
        el: '#app',
        data: {
            order: {
                order_type: '2',
                realname:'',
                mobile:'',
                number:'',
                is_delivery:0,
                province:'',
                city:'',
                county:'',
                address:'',
                goods_id:1,
                is_yongjin:0
            },
            smstext:'获取验证码',
            moneyarr:{
                goods_money:0,
                bzj_money:0,
                pxf_money:0,
            }
        },
        watch:{
            'order.number':function(val,oldval) {
                this.getprice();
            }
        },
        mounted:function(){
            city.getcity('province','city','county','','','',1);  
        },
        methods: {
            addOrder: function () {
                var self = this;
                var cfm = weui.confirm('确定提交订单吗?',function(){
                    var loading = weui.loading('loading');
                    $.ajax({
                        url:'/mobile/orderadd/buhuo',
                        data: self.order,
                        type:'post'
                    }).then(function(res){
                        loading.hide();
                        if(res.ret==1) {
                            showerror(res.msg);
                        }else if(res.ret==0){
                            showsuccess(res.msg,res.url);
                        }
                    });
                })
                
            },
            getsmscode: function () {
                AjaxUrl('/mobile/user/getsmscode');
                this.smstext = '已发送';
            },
            getprice: function () {
                var self = this;
                $.ajax({
                    url:'/mobile/orderadd/getbuhuoprice',
                    data: self.order,
                    type:'post'
                }).then(function(res){
                    if(res.ret==1) {
                    }else if(res.ret==0){
                        self.moneyarr.goods_money = res.data;
                    }
                });
            },
        }
    });
</script>